//
//  YLMyPhoneTableViewController.m
//  YLFinanceService
//
//  Created by she1323 on 2017/11/10.
//  Copyright © 2017年 she1323. All rights reserved.
//

#import "YLMyPhoneTableViewController.h"
#import "YLTitleIamgeListCell.h"
#import "YLMyPhoneViewModel.h"
#import "YLIconTitleModelGroup.h"
@interface YLMyPhoneTableViewController ()
@property (nonatomic, strong) YLMyPhoneViewModel *viewModel;
@end

@implementation YLMyPhoneTableViewController


- (YLMyPhoneViewModel *)viewModel
{
    if (!_viewModel) {
        _viewModel = [[YLMyPhoneViewModel alloc] init];
    }
    return _viewModel;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"手机号";
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([YLTitleIamgeListCell class]) bundle:nil] forCellReuseIdentifier:[YLTitleIamgeListCell cellID]];
 
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return self.viewModel.groups.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    YLIconTitleModelGroup *group = self.viewModel.groups[section];
    return group.models.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    YLIconTitleModelGroup *group = self.viewModel.groups[indexPath.section];
    YLIconTitleModel *model = group.models[indexPath.row];
    
    YLTitleIamgeListCell *cell = [tableView dequeueReusableCellWithIdentifier:[YLTitleIamgeListCell cellID]];
    cell.iconTitleModel = (YLIconTitleNoArrowModel *)model;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

- (instancetype)init
{
    return [self initWithStyle:UITableViewStyleGrouped];
}


@end
